import { _ as _export_sfc, x as useMainStore, y as storeToRefs, z as ref, al as useNavbarHeight, B as onLoad, aH as balanceGetBillList, g as createElementBlock, b as createVNode, w as withCtx, n as normalizeStyle, H as unref, F as Fragment, j as resolveEasycom, i as index$g, G as __easycom_0, k as resolveDynamicComponent, L as resolveComponent, o as openBlock, c as createBlock, S as Swiper, h as renderList, l as SwiperItem, P as ScrollView, t as createTextVNode, aI as index$p, u as toDisplayString, X as formatDateTime, ag as navigateBack } from './index-Cc4oxzDN.js';
import { _ as __easycom_1 } from './uv-tabs.CwA-F7oh.js';
import './uv-badge.D4nY_Rjy.js';

const _sfc_main = {
  __name: 'bill',
  setup(__props) {

const main = useMainStore();
const { isLogin } = storeToRefs(main);
const title = ref('账单');

// 获取导航栏高度
const { navbarHeightCss } = useNavbarHeight();

	// 返回上一页
	const $onClickLeft = () => {
		navigateBack();
	};

const orderList = ref([[], [], [], []]);
const list = ref([
				{
					name: '全部'
				},
				{
					name: '消费'
				},
				{
					name: '充值'
				},
				{
					name: '退款'
				}
			]
);
const list1 = ref([
				{
					name: '全部'
				},
				{
					name: '消费'
				}
			]
);
const current = ref(0);
const swiperCurrent = ref(0);
ref(0);
ref(0);
const loadStatus = ref(['loadmore','loadmore','loadmore','loadmore']);
const page = ref(1);
const pageSize = ref(20);
const tabs = ref();
const cate = ref(0);

onLoad((option) => {
	console.log('cate:',option.cate);
	cate.value = option.cate;
	getBill();
});

const getBill = async() => {
	if (loadStatus.value[swiperCurrent.value] == 'loading') {
		return;
	}
	loadStatus.value.splice(swiperCurrent.value,1,"loading");
	let data = await balanceGetBillList({cate:cate.value,type:swiperCurrent.value,page:page.value,pagesize:pageSize.value});
	if (page.value == 1 ){
		orderList.value[swiperCurrent.value] = [];
	}
	if (data && data.length > 0) {
		page.value++;
		orderList.value[swiperCurrent.value] = orderList.value[swiperCurrent.value].concat(data);
		
		loadStatus.value.splice(swiperCurrent.value,1,"loadmore");
	} else {
		loadStatus.value.splice(swiperCurrent.value,1,"nomore");
	}
};
const reachBottom = () => {
	if (loadStatus.value[swiperCurrent.value] == 'nomore') {
		return;
	}
	getBill();
};
// tab栏切换
const change = (e) => {
	swiperCurrent.value = e.index;
	page.value = 1;
};
const transition = ({ detail: { dx } }) => {
};
const animationfinish = ({ detail }) => {
	swiperCurrent.value = detail.current;
	current.value = detail.current;
	page.value = 1;
	getBill();
};



return (_ctx, _cache) => {
  const _component_uv_navbar = resolveEasycom(resolveDynamicComponent("uv-navbar"), __easycom_0);
  const _component_uv_tabs = resolveEasycom(resolveDynamicComponent("uv-tabs"), __easycom_1);
  const _component_v_uni_view = index$g;
  const _component_v_uni_navigator = index$p;
  const _component_u_loadmore = resolveComponent("u-loadmore");
  const _component_v_uni_scroll_view = ScrollView;
  const _component_v_uni_swiper_item = SwiperItem;
  const _component_v_uni_swiper = Swiper;

  return (openBlock(), createElementBlock(Fragment, null, [
    createVNode(_component_uv_navbar, {
      fixed: true,
      title: title.value,
      "left-arrow": "",
      onLeftClick: $onClickLeft
    }, null, 8, ["title"]),
    createVNode(_component_v_uni_view, {
      style: normalizeStyle(`padding-top: ${unref(navbarHeightCss)};`)
    }, {
      default: withCtx(() => [
        createVNode(_component_v_uni_view, { class: "wrap" }, {
          default: withCtx(() => [
            (cate.value == 0)
              ? (openBlock(), createBlock(_component_v_uni_view, {
                  key: 0,
                  class: "bg-white"
                }, {
                  default: withCtx(() => [
                    createVNode(_component_uv_tabs, {
                      activeColor: "#f29100",
                      ref_key: "tabs",
                      ref: tabs,
                      list: list.value,
                      current: current.value,
                      onChange: change,
                      scrollable: false,
                      swiperWidth: "750"
                    }, null, 8, ["list", "current"])
                  ]),
                  _: 1
                }))
              : (openBlock(), createBlock(_component_v_uni_view, {
                  key: 1,
                  class: "bg-white"
                }, {
                  default: withCtx(() => [
                    createVNode(_component_uv_tabs, {
                      activeColor: "#f29100",
                      ref_key: "tabs",
                      ref: tabs,
                      list: list1.value,
                      current: current.value,
                      onChange: change,
                      scrollable: false,
                      swiperWidth: "750"
                    }, null, 8, ["list", "current"])
                  ]),
                  _: 1
                })),
            createVNode(_component_v_uni_swiper, {
              class: "swiper-box",
              current: swiperCurrent.value,
              onTransition: transition,
              onAnimationfinish: animationfinish
            }, {
              default: withCtx(() => [
                (openBlock(true), createElementBlock(Fragment, null, renderList(orderList.value, (item, index) => {
                  return (openBlock(), createBlock(_component_v_uni_swiper_item, {
                    class: "swiper-item",
                    key: index
                  }, {
                    default: withCtx(() => [
                      createVNode(_component_v_uni_scroll_view, {
                        "scroll-y": "",
                        style: {"height":"100%","width":"100%"},
                        onScrolltolower: reachBottom
                      }, {
                        default: withCtx(() => [
                          createVNode(_component_v_uni_view, { class: "page-box" }, {
                            default: withCtx(() => [
                              (item.length == 0)
                                ? (openBlock(), createBlock(_component_v_uni_view, { key: 0 }, {
                                    default: withCtx(() => [
                                      (loadStatus.value[index] != 'loading')
                                        ? (openBlock(), createBlock(_component_v_uni_view, {
                                            key: 0,
                                            class: "centre"
                                          }, {
                                            default: withCtx(() => [
                                              createVNode(_component_v_uni_view, { class: "explain" }, {
                                                default: withCtx(() => [
                                                  createTextVNode(" 您还没有相关的账单 "),
                                                  createVNode(_component_v_uni_view, { class: "tips" }, {
                                                    default: withCtx(() => [
                                                      createTextVNode("可以去看看有那些想买的")
                                                    ]),
                                                    _: 1
                                                  })
                                                ]),
                                                _: 1
                                              }),
                                              createVNode(_component_v_uni_view, { class: "btn" }, {
                                                default: withCtx(() => [
                                                  createVNode(_component_v_uni_navigator, {
                                                    "open-type": "switchTab",
                                                    url: "/pages/menu/menu"
                                                  }, {
                                                    default: withCtx(() => [
                                                      createTextVNode("随便逛逛")
                                                    ]),
                                                    _: 1
                                                  })
                                                ]),
                                                _: 1
                                              })
                                            ]),
                                            _: 1
                                          }))
                                        : (openBlock(), createBlock(_component_v_uni_view, { key: 1 }, {
                                            default: withCtx(() => [
                                              createVNode(_component_u_loadmore, {
                                                status: loadStatus.value[index],
                                                bgColor: "#f2f2f2"
                                              }, null, 8, ["status"])
                                            ]),
                                            _: 2
                                          }, 1024))
                                    ]),
                                    _: 2
                                  }, 1024))
                                : (openBlock(), createBlock(_component_v_uni_view, { key: 1 }, {
                                    default: withCtx(() => [
                                      (openBlock(true), createElementBlock(Fragment, null, renderList(orderList.value[index], (res, resIndex) => {
                                        return (openBlock(), createBlock(_component_v_uni_view, {
                                          class: "order",
                                          key: resIndex
                                        }, {
                                          default: withCtx(() => [
                                            createVNode(_component_v_uni_view, { class: "type" }, {
                                              default: withCtx(() => [
                                                createVNode(_component_v_uni_view, null, {
                                                  default: withCtx(() => [
                                                    createTextVNode(toDisplayString(res.title), 1)
                                                  ]),
                                                  _: 2
                                                }, 1024),
                                                createVNode(_component_v_uni_view, null, {
                                                  default: withCtx(() => [
                                                    createTextVNode(toDisplayString(res.mark), 1)
                                                  ]),
                                                  _: 2
                                                }, 1024)
                                              ]),
                                              _: 2
                                            }, 1024),
                                            createVNode(_component_v_uni_view, { class: "total" }, {
                                              default: withCtx(() => [
                                                createVNode(_component_v_uni_view, null, {
                                                  default: withCtx(() => [
                                                    createTextVNode(toDisplayString(res.pm == 0 ? '-':'＋') + "￥" + toDisplayString(res.number) + "元 ", 1)
                                                  ]),
                                                  _: 2
                                                }, 1024),
                                                createVNode(_component_v_uni_view, null, {
                                                  default: withCtx(() => [
                                                    createTextVNode(toDisplayString(unref(formatDateTime)(res.createTime)), 1)
                                                  ]),
                                                  _: 2
                                                }, 1024)
                                              ]),
                                              _: 2
                                            }, 1024)
                                          ]),
                                          _: 2
                                        }, 1024))
                                      }), 128)),
                                      createVNode(_component_u_loadmore, {
                                        status: loadStatus.value[index],
                                        bgColor: "#f2f2f2"
                                      }, null, 8, ["status"])
                                    ]),
                                    _: 2
                                  }, 1024))
                            ]),
                            _: 2
                          }, 1024)
                        ]),
                        _: 2
                      }, 1024)
                    ]),
                    _: 2
                  }, 1024))
                }), 128))
              ]),
              _: 1
            }, 8, ["current"])
          ]),
          _: 1
        })
      ]),
      _: 1
    }, 8, ["style"])
  ], 64))
}
}

};
const bill = /*#__PURE__*/_export_sfc(_sfc_main, [['__scopeId',"data-v-63666587"]]);

export { bill as default };
